#第四题，字符串重复统计
import random
str1 = 'abcdefghijklmnopqrstuvwxyz'
list1 = []
dict1 = {}
for i in range(100):
    randstr = random.choices(str1,k=2)
    str2 = randstr[0] + randstr[1]
    if str2 not in dict1:
        dict1[str2] = 1
    else:
        dict1[str2] += 1
for k,v in dict1.items():
    list1.append((v,k))
print(sorted(list1,reverse=True))

# 完成的不错
